import java.util.*;

public class demo02 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            int n=sc.nextInt();
            int[] arr=new int[n];
            for (int i = 0; i < n; i++) {
                arr[i]=sc.nextInt();
            }
            Arrays.sort(arr);
            int num=count(arr,n,0,0,1);
            System.out.println(num);
        }
    }
    public static int count(int[] arr,int n,int pos,int sum,int multi){
        int count=0;
        for (int i = pos; i < n; i++) {
            sum+=arr[i];
            multi*=arr[i];
            if(sum>multi){
                count=count+1+count(arr,n,i+1,sum,multi);
            } else if (arr[i]==1) {
                count=count+count(arr,n,i+1,sum,multi);
            }else {
                break;
            }
            sum=sum-arr[i];
            multi=multi/arr[i];
            while (i<n-1&&arr[i]==arr[i+1]){
                i++;
            }
        }
        return count;
    }
}
